package com.bit.demo.demo1;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;

@Controller

@RequestMapping("/html")
public class IndexController {
    @RequestMapping("/index")
    public Object index() {
        return "/index.html";
    }

    @ResponseBody
    @RequestMapping("/index1")
    public String index1() {
        return "/index.html";
    }

    @RequestMapping("returnHtml")
    @ResponseBody
    public String returnHtml() {
        return "<h1> Hello Spring MVC </h1>";
    }

    @RequestMapping("returnJson")
    @ResponseBody
    public HashMap<String, String> returnJson() {
        HashMap<String, String> map = new HashMap<>();
        map.put("Java","Java Value");
        map.put("C++","C++ Value");
        map.put("MySQL","MySQL Value");
        return map;
    }
}
